//是否支持CA认证
export const suppoertCAAuth = () => {
    const supportCAAuth = window.em && window.em.checkJsApi && window.em.checkJsApi("CAMethod");
    return supportCAAuth;
}

//获取CA证书信息
export const getCAAuthInfo = callback => {
    if (suppoertCAAuth()) {
        window.em.CAMethod({
            func: "getCACertInfo",
            callback: "getCACertInfo",
            success: function (res) {
                callback && callback(res);
            }
        });
    }
}

//CA认证
export const checkCAAuth = (original, passWord, callback) => {
    if (suppoertCAAuth()) {
        window.em.CAMethod({
            func: "getSignValueWithPass",
            original: original,
            password: passWord,
            callback: "getSignValue",
            success: function (res) {
                callback && callback(res);
            }
        });
    }
}